package com.example.gty.controller;

import com.example.gty.entity.Student;
import com.example.gty.service.StudentSelfService;
import com.example.gty.utils.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/studentSelf")
@Api(tags = "学生基本信息管理")
public class StudentSelfController {
    @Autowired
    private StudentSelfService studentSelfService;

    @ApiOperation("查询所有学生基本信息")
    @RequestMapping(value = "/selectStudentSelfAll",method = RequestMethod.GET)
    public List<Student> selectStudentSelfAll(){
        System.err.println("查询所有学生基本信息");
        return studentSelfService.selectStudentSelfAll();
    }
    //updateStuSelf
    @ApiOperation("修改学生基本信息")
    @RequestMapping(value = "/updateStuSelf",method = RequestMethod.POST)
    public ResultVo updateStuSelf(@RequestBody Student student){
        return studentSelfService.updateStuSelf(student);
    }

    //selectStudentKey
    @ApiOperation("关键字模糊查询学生基本信息")
    @RequestMapping(value = "/selectStudentKey",method = RequestMethod.GET)
    public List<Student> selectStudentKey(String s){
        return studentSelfService.selectStudentKey(s);
    }

    @ApiOperation("批量删除学生信息")
    @RequestMapping(value = "/deleteMultiStu",method = RequestMethod.GET)
    public ResultVo deleteMultiStu(String snos){
        return studentSelfService.deleteMultiStu(snos);
    }
}
